package com.tedu.aopdemo.aop;

import org.springframework.stereotype.Component;

@Component
public class CalculatorImpl implements Calculator{
    @Override
    public int add(int a, int b) {
        int result = a+b;
        return result;
    }

    @Override
    public int sub(int a, int b) {
        return a-b;
    }

    @Override
    public int mul(int a, int b) {
        return a*b;
    }

    @Override
    public int div(int a, int b) {
        if(b==0){
            throw new RuntimeException("除数不能为0");
        }
        return a/b;
    }

    @Override
    public String add(String a,String b){
        return a;
       //sudo systemctl stop firewalled
        //ifconfig
    }
}
